import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //定义文本样式

    return Scaffold(
      appBar: AppBar(
        title: Text("Button"),
      ),
      body: Column(
        children: <Widget>[
          Container(
            //外间距
            margin: EdgeInsets.only(bottom: 20),
            color: Colors.blue,
            height: 200,
            width: 300,
            //子元素右上对齐Alignment.topRight
            alignment: Alignment.centerRight,
            child: Text("text1"),
          ),
          Container(
            //外间距
            margin: EdgeInsets.all(20),
            color: Colors.red,
            height: 200,
            width: 300,
            //子元素右上对齐Alignment.topRight
            alignment: Alignment.centerRight,
            child: Text("text2"),
          ),
          Container(
            //内间距，使用内边距，就不用设置宽高了，会自动撑开
            padding: EdgeInsets.all(20),
            color: Colors.yellow,
            //子元素右上对齐Alignment.topRight
            alignment: Alignment.centerRight,
            child: Text("text2"),
          )

        ],
      ),
    );
  }

}
